<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="../js/vue.js"></script>
		<script src="../js/axios.min.js"></script>
		<script src="../js/vue-cookies.js"></script>
	</head>
	<body>
	
		<script>
			// 创建 Vue 实例，得到 ViewModel
			var vm = new Vue({
				el: '#app',
				data: {
					name: '',
					newId: 3,
					list: [{
							id: 1,
							name: '李斯'
						},
						{
							id: 2,
							name: '吕不韦'
						},
						{
							id: 3,
							name: '嬴政'
						}
					]
				},
				methods: {
					add() {
						//注意这里是unshift
						this.list.unshift({
							id: ++this.newId,
							name: this.name
						})
						this.name = ''
					}
				}
			});
		</script>

	</body>
</html>
